// Copyright (c) 2010 Manuel Peinado Gallego <manuel.peinado@gmail.com>
// Distributed under the MIT license

// Draggable.h : interface of the Draggableclass
//

#pragma once

#include "View3d.h"
#include "TransformNode.h"
#include "SelectionManager.h"
#include "Dim.h"


class Draggable : public Pickable
{
public:

    // Returns false if the dragger does not accept this operation 
    // (usually because the selected object is not transformable)
    bool onBeginDrag(const ScreenPoint & clickPoint, int subColor);
    void onDrag(const ScreenPoint & dragPoint);
    void onEndDrag();


protected:

    // True if in the middle of a drag process (i.e., inbetween
    // calls to onBeginDrag and onEndDrag)
    bool m_dragging;

    // TODO comment
    int m_partId;

    // The cursor screen position when the drag process began
    ScreenPoint m_clickPoint;

    friend class Drawable;
    Draggable();

    // Derived classes should override those to implement their 
    // custom handling of drag events
    virtual bool onBeginDragImpl(const ScreenPoint & clickPoint);
    virtual void onDragImpl(const ScreenPoint & dragPoint);
    virtual void onEndDragImpl();
};

